package net.sxnic.jhitem.itemoperation.dao;

import java.util.List;

import net.sxinfo.core.spring25.HibernateDao;
import net.sxnic.jhitem.itemoperation.ItemOperation;

import org.springframework.stereotype.Repository;

@Repository("itemOperationDao")
public class HibernateItemOperationDao extends HibernateDao<ItemOperation, String> implements
	ItemOperationDao {

	/**
	 * 根据项目的计划类别获取页面路径
	 * @param catalog1 大类别
	 * @param catalog2 小类别
	 * @param soperCode 计划类别
	 * @return 页面路径
	 */
	public String findJspCatalog(String catalog1,String catalog2,String soperCode)
	{
		String temp = "";
		String hql = "from ItemOperation where catalog1=? and catalog2=? and soperCode=?";
		ItemOperation operation = this.findUnique(hql, new Object[]{catalog1,catalog2,soperCode});
		if(operation!=null)
		{
			temp = operation.getPagePath();
		}
		return temp;
	}
	
	/**
	 * 根据部门编码获取实体列表
	 * @param catalog1 大类别
	 * @param catalog2 小类别
	 * @param deptCode 处室编码
	 * @return 部门编码对应的实体列表
	 */
	public List<ItemOperation> findSoperCode(String catalog1,String catalog2,String deptCode)
	{
		String hql = "from ItemOperation where catalog1=? and catalog2=? and department=?";
		return this.find(hql, new Object[]{catalog1,catalog2,deptCode});
	}
	
}
